package com.glsc.ngateway.common.base.converter.platform;

import com.alibaba.excel.util.CollectionUtils;
import com.glsc.ngateway.common.base.domain.mysql.gateway.platform.it.networkassets.MaintenanceInformation;
import com.glsc.ngateway.common.base.domainmapper.MaintenanceInformationMapper;
import com.glsc.ngateway.common.api.platform.dto.it.networkassets.MaintenanceInformationDto;

import java.util.List;
import java.util.stream.Collectors;

public class MaintenanceInformationConverter {
    public static MaintenanceInformationDto do2Dto(MaintenanceInformation domain){
        return MaintenanceInformationMapper.INSTANCE.domain2dto(domain);
    }

    public static List<MaintenanceInformationDto> do2Dto(List<MaintenanceInformation> doList){
        return CollectionUtils.isEmpty(doList) ? java.util.Collections.EMPTY_LIST : doList.stream().map(MaintenanceInformationConverter::do2Dto).collect(Collectors.toList());
    }

    public static MaintenanceInformation dto2Do(MaintenanceInformationDto dto){
        return MaintenanceInformationMapper.INSTANCE.dto2domain(dto);
    }

    public static List<MaintenanceInformation> dto2Do(List<MaintenanceInformationDto> dtoList){
        return CollectionUtils.isEmpty(dtoList) ? java.util.Collections.EMPTY_LIST : dtoList.stream().map(MaintenanceInformationConverter::dto2Do).collect(Collectors.toList());
    }
}
